#include "DarkGDK.h"
// *********************************************************
// splash_screen displays the logo and allows the player
// to choose their side and start the game.  
// *********************************************************

class splash_screen {

public:

	//load the images and hover images for the splash page
	void load_splash_images( void ) {
		dbLoadMusic("Title Music.mp3", 7);	
		dbPlayMusic(7);
		dbLoadImage("splash/metal.png", 40);
		dbLoadImage("splash/metal_hover.png", 41);
		dbLoadImage("splash/magic.png", 42);
		dbLoadImage("splash/magic_hover.png", 43);
		dbLoadImage("pointer_sprite.png", 44); //for checking collision on click
	}

	int show_splash ( void ) {
		
		dbSprite(40, 0, 0, 40); //metal
		dbSprite(42, 0, 300, 42); //magic
		dbSprite(44, dbMouseX(), dbMouseY(), 44); //mouse collison sprite
		dbSetCursor(0,0); //place the cursor on screen
		dbPrint("Click to begin");
		if(dbSpriteCollision(44, 40)) //if hovering over metal show the metal hover image
			dbSprite(40, 0, 0, 41);
		if(dbSpriteCollision(44, 42)) //if hovering over magic show the magic hover image
			dbSprite(42, 0, 300, 43);
		if(check_click(40)) { //if metal is clicked return 1
			remove_splash();
			dbStopMusic(7);
			return 1;
		}
		if(check_click(42)) { //if magic is clicked return 2
			remove_splash();
			dbStopMusic(7);
			return 1; //SHOULD BE 2, but have some team bugs
		}
		return 0; //while nothing is clicked return 0
	}

	// deletes both sprites
	void remove_splash(void) {
		dbDeleteSprite(40);
		dbDeleteSprite(42);
	}

	//if the mouse is clicked check if the proper sprite is clicked
	bool check_click ( int sprite ) {
		if(dbMouseClick() == 1 ) {
			return dbSpriteCollision(44, sprite);
		}
		return 0; //if nothing is clicked return 0
	}

};